/*
 * CHttpDownloader.h
 *
 *  Created on: 2017年7月26日
 *      Author: terry
 */

#ifndef CHTTPDOWNLOADER_H_
#define CHTTPDOWNLOADER_H_

#include "HttpDownloader.h"
#include "SharedPtr.h"

class CHttpDownloader : public HttpDownloader, public HttpClientCallback
{
public:
	CHttpDownloader();
	virtual ~CHttpDownloader();

	virtual bool download(const std::string& url, const std::string& filepath, const StringMap& headers, Sink* sink);

	virtual void close();

protected:
	virtual void handleResponse(int code, const char* body, size_t size);

protected:
	std::string	m_url;
	std::string	m_filepath;
	Sink*	m_sink;

	std::shared_ptr<HttpClient>	m_client;
	
};

#endif /* CHTTPDOWNLOADER_H_ */
